package db

const TableNameTypeProgramme = TablePrefix + "type_programme"

type TypeProgramme struct {
	BaseModel
	TypeID  uint   `gorm:"column:type_id;type:int(11);default:0;comment:类型id" json:"type_id" form:"type_id"`      // 类型id
	Name    string `gorm:"column:name;type:varchar(255);default:'';comment:方案名称" json:"name" form:"name"`         // 方案名称
	IsShow  int    `gorm:"column:is_show;type:tinyint(1);default:0;comment:展示,不展示" json:"is_show" form:"is_show"` // 展示,不展示
	Upgrade int    `gorm:"column:upgrade;type:tinyint(1);default:0;comment:升级,合成" json:"upgrade" form:"upgrade"`  // 1=升级 0=合成
	IsMj    int    `gorm:"column:is_mj;type:tinyint(1);default:0;comment:1=母舰" json:"is_mj" form:"is_mj"`         // 1=母舰
	Num     int64  `gorm:"column:num;type:int(11);default:0;comment:数量" json:"num" form:"num"`                    // 数量
	Remain  int64  `gorm:"column:remain;type:int(11);default:0;comment:剩余数量" json:"remain" form:"remain"`         // 剩余数量
}

func (*TypeProgramme) TableName() string {
	return TableNameTypeProgramme
}

type TypeProgrammeHasOneType struct {
	TypeProgramme
	TypeInfo        Type                                  `gorm:"foreignKey:id;references:type_id" json:"type_info"`
	SynthesisScheme []TypeProgrammeHasManySynthesisScheme `gorm:"foreignKey:type_id;references:type_id" json:"synthesis_scheme"`
}

type TypeProgrammeHasManySynthesisScheme struct {
	TypeProgramme
	ProgrammeSource []TypeProgrammeSourceHasOneType `gorm:"foreignKey:programme_id;references:id" json:"programme_source"`
}

type TypeProgrammeHasOneTypeFind struct {
	TypeProgramme
	TypeInfo        Type                            `gorm:"foreignKey:id;references:type_id" json:"type_info"`
	ProgrammeSource []TypeProgrammeSourceHasOneType `gorm:"foreignKey:programme_id;references:id" json:"programme_source"`
}
